/*
	项目名称：wxyS辅助开发框架 版本：V2.0
	本文件内容：wxySV2.0项目 wxyJS内容
	wxyS V2.0开发编写者：辛酉戊戌戊寅（网络用户），中国居民身份证号： 230104198110270213。
	wxyS V2.0开发起始期：2015年1月1日
	wxyS V2.0开发结束日期：持续更新中……
	wxyS V2.0遵循开源协议 MIT 标准。请后续使用者了解MIT 标准后使用。
	使用提示：
		1、本应为HTML5环境使用。请在使用是选择可支持HTML5的现代浏览器。（建议谷歌浏览器）。
		2、部分功能需要jquery3.0支持。请在使用环境中先导入jquery3.0后在使用。
*/


var wxySB64_Str1 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

/*总接口*/
var wxyS$Main = {
	New:function(){
	var FUN = {};
		FUN.Inp1 = "";
		FUN.version = "2.0";
		FUN.Exp1 = function(){
			return FUN.Inp1;
		}//FUN.Exp1 = fun Inp1输出
		FUN.Base641E = function(){
			var FUN_n_cs1 = arguments[0]?arguments[0]:"wxySNULL";//设置第一个参数的默认值为1
			if(FUN_n_cs1.toString()!="wxySNULL"){
				return wxyS_Encode(FUN_n_cs1.toString());
			}else{
				return wxyS_Encode();
			}//if(FUN_n_cs1.toString()!="
		}//FUN.Base641E = fun Base64加解密方案1 加js
		FUN.Base641D = function(){
			var FUN_n_cs1 = arguments[0]?arguments[0]:"wxySNULL";//设置第一个参数的默认值为1
			if(FUN_n_cs1.toString()!="wxySNULL"){
				return wxyS_Decode(FUN_n_cs1.toString());
			}else{
				return wxyS_Decode();
			}//if(FUN_n_cs1.toString()!="
		}//FUN.Base641D = fun Base64加解密方案1 解js
		FUN.nav1Str1 = "";
		FUN.nav1 = function(){
			var nav1FHZ1 = "";
			if(navigator.userAgent.match(/(iPhone|iPod|Android|ios|Windows Phone|iPad|SymbianOS)/i)){
				nav1FHZ1 = 'MAweb';
				if(wxyS_ISWeiXin()){
					nav1FHZ1 = 'WeiXin';
				}else{
					if(FUN.nav1Str1=="MAAPP"){
						nav1FHZ1 = 'MA';
					}else{
						nav1FHZ1 = 'MAweb';
					}//if(FUN.nav1Str1=="web
				}//if(wxyS_ISWeiXin(
			}else{
				nav1FHZ1 = 'PC';
				nav1FHZ1 = wxyS_IE();
			}//if(navigator.userA
			return nav1FHZ1;
		}//FUN.nav1 = fun   设备和浏览器判断
		FUN.DomAdd1 = function(){
			var IDz01 = arguments[0]?arguments[0]:"";
			var cssText = arguments[1]?arguments[1]:"";
			if(IDz01!=""&&cssText!=""){
				var CSS_LLQPD1 = "X";
				var CSS_userAgent = navigator.userAgent;
				var CSS_isIE1 = CSS_userAgent.toLowerCase().indexOf("compatible")>-1&&CSS_userAgent.indexOf("MSIE")>-1;
				if(CSS_isIE1){
					var reIE = new RegExp("MSIE (\\d+\\.\\d+);"); 
					reIE.test(CSS_userAgent); 
					var fIEVersion = parseFloat(RegExp["$1"]); 
					switch(fIEVersion.toString()){
						case '7':
							CSS_LLQPD1 = "IE" + "8x";
							break;
						case '8':
							CSS_LLQPD1 = "IE" + "8";
							break;
						default:
							CSS_LLQPD1 = "X";
							break;
					}//switch(fIEVersion.toString())
				}else{
					CSS_LLQPD1 = "X";
				}//if(isIE)
				var stylesid1 = document.getElementById(IDz01.toString());
				if(CSS_LLQPD1!="X"){
					stylesid1.styleSheet.cssText = (stylesid1.styleSheet.cssText+cssText.toString()).toString();
				}else{
					var textNodesid2 = document.createTextNode(cssText.toString());
					stylesid1.appendChild(textNodesid2);
				}
			}//if(IDz01!=""&&cssText!=
		}///FUN.DomAdd1      DIV P TABLE 添加
		FUN.DomRemove1 = function(){
			var sId = arguments[0]?arguments[0]:"";
			if(sId!=""){
				var mySelect = document.getElementById(sId); 
				mySelect.parentNode.removeChild(mySelect); 
			}//if(sId!="")
		}//FUN.DomRemove1  DIV P TABLE 删除
		FUN.UrlGet1 = function(){
			var N_id1 = arguments[0]?arguments[0]:"";//设置第一个参数的默认值为1
			var FHZ000 = "";
			if(N_id1!=""){
				FHZ000 = wxyS_Get(cs1);
			}
			return FHZ000;
		}//FUN.UrlGet1 JS 获取URL地址栏GET传值
		FUN.BGFull1 = function(){
			var id1 = arguments[0]?arguments[0]:0;//设置第一个参数的默认值为1
			var CS1 = arguments[1]?arguments[1]:0;//设置第一个参数的默认值为1
			var CS2 = arguments[2]?arguments[2]:0;//设置第一个参数的默认值为1
			wxyS_imgBGcl1(id1,CS1,CS2);
		}//FUN.BGFull1 全屏图片背景自适应
		FUN.ENdn = function(){
			var Ncs1 = arguments[0]?arguments[0]:0;//设置第一个参数的默认值为1
			var FHZ = 0;
			if(Ncs1.toString()!="0"){
				FHZ = wxyS_EN1(parseInt(Ncs1));
			}
			return FHZ;
		}//FUN.ENup 向下偶数调整化，可调整值1.
		FUN.PCSCRLocation = function(){
			wxyS_PCDingDi();
		}//FUN.PCSCRLocation  body滚动条定位
		FUN.DateF1 = function(){
			wxyS_DTNow1();
		}//FUN.DateF1  格式输出当前日期时间2019-8-1 9:32:44.0
		FUN.Clicks = function(){
			var id = arguments[0]?arguments[0]:"";
			var FUNing = arguments[1]?arguments[1]:function(){};
			var lx = arguments[2]?arguments[2]:"0";
			var FUNlx = arguments[3]?arguments[3]:FUN.nav1();
			switch(lx.toUpperCase()){
				case '1':
					return wxyS_ButtonDTJZ_DCid1(id,FUNing,FUNlx);
					break;
				default:
					return wxyS_ButtonDTJZ_DCid2(id,FUNing,FUNlx);
					break;
			}//switch(lx.to
		}//FUN.DateF1  Click方案集合
		return FUN;
	}//New:function()
}//wxyJS$
var wxyS$ = wxyS$Main.New();/*默认应用实例*/


//public method for encoding 加密
function wxyS_Encode(){
	var input = arguments[0]?arguments[0]:"wxySNULL";//设置第一个参数的默认值为1
	var N_FHZEncode="";
	if(input.toString()!="wxySNULL"){
		var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0;
		input = escape(input.toString());
		input = wxyS_UTF_8_Encode(input.toString());
		while (i < input.length) {
			chr1 = input.charCodeAt(i++);//charCodeAt在C#中的实现byte[] by = System.Text.Encoding.Default.GetBytes(input);
			chr2 = input.charCodeAt(i++);
			chr3 = input.charCodeAt(i++);
			enc1 = chr1 >> 2;
			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
			enc4 = chr3 & 63;
			output = output + wxySB64_Str1.charAt(enc1) + wxySB64_Str1.charAt(enc2) + wxySB64_Str1.charAt(enc3) + wxySB64_Str1.charAt(enc4);
		}//while
		N_FHZEncode = output;
	}else{
		N_FHZEncode = "$N$U$L$L$";
	}//if(N_cs1.toString()=="wxySNULL")
	return N_FHZEncode;
}//wxyS_Encode
// public method for decoding 解密
function wxyS_Decode(){
	var input = arguments[0]?arguments[0]:"wxySNULL";//设置第一个参数的默认值为1
	var N_FHZEncode="";
	if(input.toString()!="wxySNULL"){
		var output = "", chr1, chr2, chr3, enc1, enc2, enc3, enc4, i = 0;
		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
		while (i < input.length) {
			enc1 = wxySB64_Str1.indexOf(input.charAt(i++));
			enc2 = wxySB64_Str1.indexOf(input.charAt(i++));
			enc3 = wxySB64_Str1.indexOf(input.charAt(i++));
			enc4 = wxySB64_Str1.indexOf(input.charAt(i++));
			chr1 = (enc1 << 2) | (enc2 >> 4);
			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
			chr3 = ((enc3 & 3) << 6) | enc4;
			output = output + String.fromCharCode(chr1);
			/**/
			if (enc3 != 64) {
				output = output + String.fromCharCode(chr2);
			}
			if (enc4 != 64) {
				output = output + String.fromCharCode(chr3);
			}
		}//while
		output = wxyS_UTF_8_Decode(output);
		output = unescape(output.toString());
		N_FHZEncode = output;	
	}else{
		N_FHZEncode = "$N$U$L$L$";
	}//if(N_cs1.toString()=="wxySNULL")
	return N_FHZEncode;
}//wxyS_Encode
//UTF-8处理
// private method for UTF-8 encoding 加密
function wxyS_UTF_8_Encode(string){
	string = string.replace(/\r\n/g,"\n");
	var utftext = "";
	for(var n = 0; n < string.length; n++){
		var c = string.charCodeAt(n);
		if (c < 128) {
			utftext += String.fromCharCode(c);
		} else if((c > 127) && (c < 2048)) {
			utftext += String.fromCharCode((c >> 6) | 192);
			utftext += String.fromCharCode((c & 63) | 128);
		} else {
			utftext += String.fromCharCode((c >> 12) | 224);
			utftext += String.fromCharCode(((c >> 6) & 63) | 128);
			utftext += String.fromCharCode((c & 63) | 128);
		}//if
	}//for(var n = 0; n < string.length; n++)
	return utftext;
}//wxyS_UTF_8_encode(string)
// private method for UTF-8 decoding 解密
function wxyS_UTF_8_Decode(utftext){
	var string = "", i = 0, c = 0, c1 = 0, c2 = 0, c3 = 0;
	while( i < utftext.length ){
		c = utftext.charCodeAt(i);
		if(c < 128){
			string += String.fromCharCode(c);
			i++;
		} else if((c > 191) && (c < 224)) {
			c2 = utftext.charCodeAt(i+1);
			string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
			i += 2;
		} else {
			c2 = utftext.charCodeAt(i+1);
			c3 = utftext.charCodeAt(i+2);
			string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
			i += 3;
		}//if
	}//while
	return string;
}//wxyS_UTF_8_decode(utftext)
//判断用户是否在微信中打开
function wxyS_ISWeiXin(){ 
	var ua = navigator.userAgent.toLowerCase(); 
	if(ua.indexOf('micromessenger')!=-1){ 
		return true; 
	}else{ 
		return false; 
	}//if
}//wxyS_ISWeiXin() wei
//获取get
function wxyS_Get(name){
	var FHZ000 = "";
	var FHZ001;
	var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
	var r = window.location.search.substr(1).match(reg);
	if(r!=null){
		FHZ001 = unescape(r[2]);
	}else{
		FHZ001 = null;
	}
	if(FHZ001 !=null && FHZ001.toString().length>1)
	{
	   FHZ000 = FHZ001;//alert(GetQueryString("url"));
	}
	return FHZ000;
	
   // if(r!=null)return  unescape(r[2]); return null;
}//wxyS_Get JS 获取URL地址栏GET传值
//全屏图片背景
function wxyS_imgBGcl1(){
	var N_id1 = arguments[0]?arguments[0]:0;//设置第一个参数的默认值为1
	var N_CS1 = arguments[1]?arguments[1]:0;//设置第一个参数的默认值为1
	var N_CS2 = arguments[2]?arguments[2]:0;//设置第一个参数的默认值为1
	var Ncs01 = parseInt(N_CS1);
	var Ncs02 = parseInt(N_CS2);
	var g01 = 0;
	var g02 = 0;
	var idcs1 = document.getElementById(N_id1);
	if(N_CS1!=0&&N_CS2!=0){
		
		if(Ncs01>Ncs02){
			g01 = parseInt(Ncs01+32);
			g02 = parseInt(parseInt(parseInt(g01)/16)*9);
			g02 = g02<Ncs02?(parseInt(parseInt(Ncs02)+4)):g02;
		}else{
			g02 = parseInt(Ncs02+32);
			g01 = parseInt(parseInt(parseInt(g02)/16)*9);
			g01 = g01<Ncs01?(parseInt(parseInt(Ncs01)+4)):g01;
		}//if(Ncs01>Ncs02)
		idcs1.style.width = (g01.toString()+"px").toString();
		idcs1.style.height = (g02.toString()+"px").toString();
	}//if(N_CS1!=0&&N_CS2!=0)
}//wxyS_imgBGcl1
//数字向下偶数化
function wxyS_EN1(cs1){
	var FHZ01 = parseInt(cs1);
	var pdz1 = parseInt(parseInt(cs1)%2);
	if(parseInt(pdz1)>0){
		FHZ01 = parseInt(parseInt(cs1) - 1);
	}
	return parseInt(FHZ01);
}//wxyS_EN1
//body滚动条定位方案1
function wxyS_PCDingDi(){
	//window.addEventListener("scroll",function(e){
		var ht =document.documentElement.scrollTop||document.body.scrollTop;
		var hd = document.documentElement.scrollHeight - document.documentElement.scrollTop||document.body.scrollHeight-document.body.scrollTop;
		var hz = document.documentElement.clientHeight||document.body.clientHeight;
		//$("#gdtxx").html(ht);
		if(ht<=0){
			//alert("到顶部了");
			return "top";
		}else{
			if(hd==hz){
				//alert("到底部了");
				return "bottom";
			}else{
				return ht;
			}
		}
	//});
}//wxyS_PCDingDi 滚动条头body 顶、底、中间值获取
//格式输出当前日期时间2019-8-1 9:32:44.0
function wxyS_DTNow1(){
	var cs1 = arguments[0]?arguments[0]:0;
	var now = new Date();
	if(cs1==0){
		now = (now.getFullYear()) + "-" + (now.getMonth() + 1) + "-" + (now.getDate()) + " " +  (now.getHours()) + ":" +  (now.getMinutes()) + ":" +  (now.getSeconds()) + ".0";
	}else{
		 now = cs1;
	}//if(cs1==0)
	return now;
}//wxyS_DTNow1  格式输出当前日期时间2019-8-1 9:32:44.0
//判断是否是IE浏览器
function wxyS_IE(){
	if (!!window.ActiveXObject || "ActiveXObject" in window){
		return "PCIE";
	}else{
		return "PC";
	}
}//wxyS_IE
//按钮事件加载，回调单ID参数方案1
function wxyS_ButtonDTJZ_DCid1(){
	var id = arguments[0]?arguments[0]:"";
	var FUNing = arguments[1]?arguments[1]:function(){};
	var FUNlx = arguments[2]?arguments[2]:"PC";
	var FHZing;
	if(id!=""){
		var JZname1 = id;
		if(FUNlx.toUpperCase()=="PC"){
			FHZing = $(JZname1).bind("click",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
				FUNing({"QB1":ck_QBz1});
			});//$(Page_anDomName_1).bind("click",	
		}else{
			FHZing = $(JZname1).bind("touchstart",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
			});//$(Page_anDomName_1).bind("touchstart",func
			$(JZname1).bind("touchmove",function(){});
			$(JZname1).bind("touchcancel",function(){});
			$(JZname1).bind("touchend",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
				FUNing({"QB1":ck_QBz1});
			});//$(Page_anDomName_1).bind("touchend",fun	
		}//if(wxyS$.nav1().toUpperCase()!="
	}//f(id!="")
	return FHZing;
}//wxyS_ButtonDTJZ_DCid1
function wxyS_ButtonDTJZ_DCid2(){
	var id = arguments[0]?arguments[0]:"";
	var FUNing = arguments[1]?arguments[1]:function(){};
	var FUNlx = arguments[2]?arguments[2]:"PC";
	var FHZing;
	if(id!=""){
		var JZname1 = "#"+id;
		if(FUNlx.toUpperCase()=="PC"){
			FHZing = $(JZname1).bind("click",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
				FUNing({"QB1":ck_QBz1});
			});//$(Page_anDomName_1).bind("click",	
		}else{
			FHZing = $(JZname1).bind("touchstart",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
			});//$(Page_anDomName_1).bind("touchstart",func
			$(JZname1).bind("touchmove",function(){});
			$(JZname1).bind("touchcancel",function(){});
			$(JZname1).bind("touchend",function(event){
				var ck_QBz1;
				var e_hq1 = event.target||event.srcElement;
				ck_QBz1 = e_hq1.id;//this.id;
				FUNing({"QB1":ck_QBz1});
			});//$(Page_anDomName_1).bind("touchend",fun	
		}//if(wxyS$.nav1().toUpperCase()!="
	}//f(id!="")
	return FHZing;
}//wxyS_ButtonDTJZ_DCid2

/*
	未进入大包项目
*/



/*按钮组操作
wxyS$.Clicks('[an="d"]',LX1_ClicksFL,"1");
function LX1_ClicksFL(){
	var CSJson1 = arguments[0]?arguments[0]:{
		"QB1":"",
		"CZLX1":"wxySGG1"
	}//
	var N_cz1 = CSJson1;
	var N_cs1 = {
		"QB1":N_cz1.QB1,
		"CZLX1":N_cz1.CZLX1||"wxySGG1"
	}//
	var switch1PD = "1";
	if(N_cs1.QB1!=""){
		switch(N_cs1.QB1){
			case 'd':
				alert("OK");
				break;
		}//switch
	}//if(N_cs1.QB1!=
}//LX1_ClicksFL


按钮组操作
wxyS$.Clicks('d2',function cs1(){
	alert("ancs1");
});
*/









